package com.bsj.travel.def.common.DTO.web.user;

import com.bsj.crypt.annotation.SensitiveFiled;
import com.bsj.travel.constant.RegularExpressionConstants;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/***
 * @description UserDTO
 * @author LiJiaXin
 * @version 1.0.0
 * @time 2024/1/9 19:35
 **/
@Data
public class UserDTO {

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 角色id
     */
    @NotNull(message = "绑定角色不能为空")
    private Integer roleId;

    /**
     * 上级id
     */
    private Integer parentId;

    /**
     * 用户名
     */
    @Pattern(regexp = RegularExpressionConstants.USERNAME_REGEXP, message = "用户名仅支持数字和字母，长度在20位以内")
    @NotBlank(message = "用户名不能为空")
//    @Length(max = 30,message = "用户名长度不能超过30")
    @SensitiveFiled
    private String userName;


    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Length(max = 30,message = "密码长度不能超过30")
    private String passWord;

    /**
     * 代码简称
     */
    @Length(max = 30,message = "代码简称长度不能超过30")
    @NotBlank(message = "代码简称不能为空")
    private String code;

    /**
     * 手机号
     */
    @Length(min = 11, max = 11, message = "手机号格式错误")
    private String phone;

    /**
     * 备注
     */
    @Length(max = 50, message = "备注信息长度不能超过50")
    private String remark;

}
